/*
 * claplan_print.h
 *
 *  Created on: 2 Nov 2013
 *      Author: Tom Vercauteren
 */

#ifndef CLAPLAN_PRINT_H_
#define CLAPLAN_PRINT_H_

#include <sstream>
#include <ostream>
#include <iomanip>

/**
 * Print a claplan parameter based on a key-value pair.
 * @param os output stream
 * @param k parameter key
 * @param v parameter value
 * @return Output stream
 */
template<typename K, typename V>
std::ostream & print_kv(std::ostream &os, const K& k, const V& v)
{
	std::ostringstream ss;
	ss.setf(std::ios::left);
	ss << "\t" << std::setw(20) << k << " = " << v;
	return os << ss.str() << std::endl;
}

/**
 * Print a claplan parameter based on key-value pair.
 * @param os output stream
 * @param k parameter key
 * @param v an array of parameter values
 * @param nv number of parameter values
 * @return Output stream
 */
template<typename K, typename V>
std::ostream & print_kv(std::ostream &os, const K& k, const V* v, unsigned nv)
{
	std::ostringstream ss;
	ss.setf(std::ios::left);
	ss << "\t" << std::setw(20) << k << " = ";
	for (unsigned i = 0; i < nv; i++)
	{
		ss << v[i];
		if (i != nv - 1) ss << " ; ";
	}
	return os << ss.str() << std::endl;
}

/**
 * Print the class solution header comment block.
 * @param os output stream
 * @return Output stream
 */
std::ostream & print_class_solution_header(std::ostream &os);

/**
 * Print a comment block with text inside it.
 * @param os output stream
 * @param s text
 * @return Output stream
 */
std::ostream & print_comment_block(std::ostream &os, const std::string &s);

#endif /* CLAPLAN_PRINT_H_ */
